HTTP.jl 2.0 support#129
Merged
Merged
Conversation
HTTP.jl 2.0 reworked client timeout keywords: `readtimeout` is now a deprecated alias that maps to the inactivity-based `read_idle_timeout`, and the overall request deadline uses the new `request_timeout` keyword. Detect the HTTP major version once at load time and pass the matching timeout keyword: `request_timeout` on 2.x, `readtimeout` on 1.x. The `retry` / `retry_non_idempotent` keywords are unchanged across versions. Widen the HTTP compat bound to "1, 2" and bump the package to 0.1.7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HTTP.jl 2.0 reworked the server API: the `stream = true` mode of `serve!` and the `setstatus` / `setheader` / `startwrite` streaming helpers were removed in favor of returning an `HTTP.Response` from the handler, and the running-server handle type changed from `HTTP.Servers.Server` to `HTTP.Server`. Rewrite the `/metrics` handler to buffer the body and return a `Response` — a single code path that works on both HTTP 1.x and 2.x via the still-supported `Router` / `register!` / `serve!` request-handler API. Drop the now version-specific field type annotation on the stored server handle. The pushgateway path (`HTTP.request`, `HTTP.Headers`) is unchanged and already cross-version. Widen the HTTP compat bound to "1, 2" and bump the package to 0.3.2. Verified: the package's test suite (33 tests, including the end-to-end `/metrics` HTTP round-trip) passes under both HTTP 1.x and HTTP 2.4.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`Base.pkgversion(m)` can return `nothing` (its documented behavior when a module wasn't loaded from a versioned package); `nothing >= v"2"` would then throw at module load. Guard it and fall back to API feature detection — `HTTP.Servers` exists throughout HTTP 1.x and was removed in 2.0 — which also covers Julia < 1.9 where `pkgversion` is unavailable. Verified the primary and fallback branches agree on both HTTP 1.11 and 2.4, and that a full export round-trip (encode → POST → decode response body) returns EXPORT_SUCCESS against a local collector on both versions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.